let isDev = process.env.NODE_ENV === "development";

const UUID = isDev ? "uuid_key_dev" : "uuid_key";
const HAS_LOGIN = isDev ? "has_login_key_dev" : "has_login_key";
const ACCESS_TOKEN = isDev ? "access_token_key_dev" : "access_token_key";
const REFRESH_TOKEN = isDev ? "refresh_token_key_dev" : "refresh_token_key";
const USER_INFO = isDev ? "user_info_obj_dev" : "user_info_obj";
const FACE_LOGIN = isDev ? "face_login_dev" : "face_login";
const FINGER_LOGIN = isDev ? "finger_login_dev" : "finger_login";
const CART_BACKBTN = isDev ? "cart_backbtn_dev" : "cart_backbtn";
const TG_CODE = isDev ? "tg_code_dev" : "tg_code";
const VIP_RATE = isDev ? "vip_rate_dev" : "vip_rate";
const AD_CODE = isDev ? "ad_code_dev" : "ad_code";
const MAP_CODE = isDev ? "map_code_dev" : "map_code";
const GUIDE_VIP = isDev ? "guide_vip_dev" : "guide_vip";
const BUSINESS = isDev ? "business_dev" : "business";
const BUSINESS_RECHARGE = isDev ? "business_recharge_dev" : "business_recharge";
const NEW_USER = isDev ? "new_user_dev" : "new_user";



export default {
	// 写入热门搜索时间戳
	setHotWords(val) {
		uni.setStorageSync("hotWords", val);
	},
	// 获取热门搜索时间戳
	getHotWords() {
		return uni.getStorageSync(`hotWords`);
	},

	// 获取face id登录
	getFaceLogin() {
		return uni.getStorageSync(FACE_LOGIN);
	},
	// 写入face id
	setFaceLogin(val) {
		uni.setStorageSync(FACE_LOGIN, val);
	},
	// 获取指纹登录
	getFingerLogin() {
		return uni.getStorageSync(FINGER_LOGIN);
	},
	// 写入指纹登录
	setFingerLogin(val) {
		uni.setStorageSync(FINGER_LOGIN, val);
	},
	// 写入用户信息
	setUserInfo(val) {
		if (!val || val == 'null') {
			uni.clearStorage()
		} else {
			uni.setStorageSync(USER_INFO, val);
		}
	},
	// 获取用户信息
	getUserInfo() {
		return uni.getStorageSync(USER_INFO);
	},
	// 移除用户信息
	removeUserInfo() {
		return uni.removeStorageSync(USER_INFO);
	},
	// 写入uuid
	setUuid(val) {
		uni.setStorageSync(UUID, val);
	},
	// 获取uuid
	getUuid() {
		return uni.getStorageSync(UUID);
	},
	// 移除uuid
	removeUuid() {
		return uni.removeStorageSync(UUID);
	},
	// 写入登录
	setHasLogin(val) {
		uni.setStorageSync(HAS_LOGIN, val);
	},
	// 获取是否登录
	getHasLogin() {
		return uni.getStorageSync(HAS_LOGIN);
	},
	// 删除uuid
	removeUuid() {
		uni.removeStorageSync(UUID);
	},
	// 写入accessToken
	setAccessToken(val) {
		uni.setStorageSync(ACCESS_TOKEN, val);
	},
	// 获取accessToken
	getAccessToken() {
		return uni.getStorageSync(ACCESS_TOKEN);
	},
	// 移除accessToken
	removeAccessToken() {
		return uni.removeStorageSync(ACCESS_TOKEN);
	},
	// 后退购物车
	setCartBackbtn(val) {
		uni.setStorageSync(CART_BACKBTN, val);
	},

	// 删除token
	removeAccessToken() {
		uni.removeStorageSync(ACCESS_TOKEN);
	},
	// 写入刷新token
	setRefreshToken(val) {
		uni.setStorageSync(REFRESH_TOKEN, val);
	},
	// 获取刷新token
	getRefreshToken() {
		return uni.getStorageSync(REFRESH_TOKEN);
	},
	// 删除token
	removeRefreshToken() {
		uni.removeStorageSync(REFRESH_TOKEN);
	},
	// 存推广码
	setTgCode(val) {
		uni.setStorageSync(TG_CODE, val);
	},
	// 获取推广码
	getTgCode() {
		return uni.getStorageSync(TG_CODE);
	},
	// 存储会员费率
	setVipRate(val) {
		uni.setStorageSync(VIP_RATE, val);
	},
	// 获取会员费率
	getVipRate() {
		return uni.getStorageSync(VIP_RATE);
	},
	// 移除会员费率
	removeVipRate() {
		return uni.removeStorageSync(VIP_RATE);
	},
	// 保存地区Code
	setAdCode(val) {
		let params = {}
		params.chooseCode = val.adCode
		params.consigneeAddressPath = val.consigneeAddressPath
		params.trapeze = val.trapeze
		uni.setStorageSync(AD_CODE, params);
	},
	// 获取地区Code
	getAdCode() {
		return uni.getStorageSync(AD_CODE);
	},
	// 保存地区Code
	setMapCode(val) {
		uni.setStorageSync(MAP_CODE, val);
	},
	// 获取地区Code
	getMapCode() {
		return uni.getStorageSync(MAP_CODE);
	},
	// 写入accessToken
	setGuideVip(val) {
		uni.setStorageSync(GUIDE_VIP, val);
	},
	// 获取accessToken
	getGuideVip() {
		return uni.getStorageSync(GUIDE_VIP);
	},
	// 移除accessToken
	removeGuideVip() {
		return uni.removeStorageSync(GUIDE_VIP);
	},
	// 写入accessToken
	setBusiness(val) {
		uni.setStorageSync(BUSINESS, val);
	},
	// 获取accessToken
	getBusiness() {
		return uni.getStorageSync(BUSINESS);
	},
	// 移除accessToken
	removeBusiness() {
		return uni.removeStorageSync(BUSINESS);
	},
	// 写入accessToken
	setBusinessRecharge(val) {
		uni.setStorageSync(BUSINESS_RECHARGE, val);
	},
	// 获取accessToken
	getBusinessRecharge() {
		return uni.getStorageSync(BUSINESS_RECHARGE);
	},
	// 移除accessToken
	removeBusinessRecharge() {
		return uni.removeStorageSync(BUSINESS_RECHARGE);
	},
	// 写入newUser
	setNewUser(val) {
		uni.setStorageSync(NEW_USER, val);
	},
	// 获取newUser
	getNewUser() {
		return uni.getStorageSync(NEW_USER);
	},
	// 移除newUser
	removeNewUser() {
		return uni.removeStorageSync(NEW_USER);
	}
};
